﻿using System.Web.Routing;

namespace Nb.Common.Themes.Providers
{
    /// <summary>
    /// 默认从query string 中读取
    /// </summary>
    internal class QueryThemeProvider : IThemeProvider
    {
        public Theme GetTheme(RequestContext requestContext)
        {
            var theme = requestContext.HttpContext.Request["Theme"];
            var themeResult = new Theme();
            themeResult.Priority = Theme.DefaultPriority + 2;
            themeResult.Name = theme;
            themeResult.Provider = "QueryThemeProvider";
            return themeResult;
        }

        public int Priority {
            get { return Theme.DefaultPriority + 2; }
        }
    }
}